#include "stdio.h"
#include "stdlib.h"

// get the mean value of two numbers, using a pointer parameter to take the result back
void avg(double x, double y, double *result);

// the main function
int main()
{
    double result;
    double x = 5.0, y = 6.0;

    avg(x, y, &result);

    // call the function
    printf("Average of %f and %f is: %f\n", x, y, result);

    return 0;
}

void avg(double x, double y, double *result)
{
    *result = (x + y) / 2.0;
}
